<?php
$this->Html->addCrumb('<i class="fa fa-home"></i> ' . Inflector::camelize('Início'), '/', array('escape' => false));
$this->Html->addCrumb(__('Shopping Cart'), NULL, array('escape' => false));
?>
<div class="col-xs-12 fundo_branco">
    <?php
    if (empty($shop['OrderItem'])) {
        echo $this->element('sem_registro');
    } else {
        echo $this->Form->create(NULL, array('url' => array('controller' => 'shop', 'action' => 'cartupdate')));
        ?>

        <hr>

        <div class="row">
            <div class="col-sm-1"></div>
            <div class="col-sm-7"><?php echo __('Itens'); ?></div>
            <div class="col-sm-1"><?php echo __('Price'); ?></div>
            <div class="col-sm-1"><?php echo __('Quantity'); ?></div>
            <div class="col-sm-1"><?php echo __('Subtotal'); ?></div>
            <div class="col-sm-1"><?php echo __('Remove'); ?></div>
        </div>

        <?php $tabindex = 1; ?>
        <?php foreach ($shop['OrderItem'] as $key => $item) { ?>

            <div class="row" id="row-<?php echo $key; ?>">
                <div class="col-sm-1"><?php echo $this->Html->image('/images/' . $item['ProductsImage'][0]['image'], array('class' => 'px60')); ?></div>
                <div class="col-sm-7">
                    <strong><?php echo $this->Html->link($item['Product']['name'], array('controller' => 'products', 'action' => 'view', 'slug' => $item['Product']['slug'])); ?></strong>
                    <?php
                    $mods = 0;
                    if (isset($item['Product']['productmod_name'])) :
                        $mods = $item['Product']['productmod_id'];
                        ?>
                        <br />
                        <small><?php echo $item['Product']['productmod_name']; ?></small>
                    <?php endif; ?>
                </div>
                <div class="col-sm-1" id="price-<?php echo $key; ?>"><?php echo $this->Formatacao->moeda($item['Product']['price']); ?></div>
                <div class="col-sm-1"><?php echo $this->Form->input('quantity-' . $key, array('div' => false, 'class' => 'numeric form-control input-small', 'label' => false, 'size' => 2, 'maxlength' => 2, 'tabindex' => $tabindex++, 'data-id' => $item['Product']['id'], 'data-mods' => $mods, 'value' => $item['quantity'])); ?></div>
                <div class="col-sm-1" id="subtotal_<?php echo $key; ?>"><?php echo $this->Formatacao->moeda($item['subtotal']); ?></div>
                <div class="col-sm-1"><span class="remove fa fa-trash" id="<?php echo $key; ?>"></span></div>
            </div>
        <?php } ?>

        <hr>

        <div class="row">
            <div class="col-sm-12">
                <div class="pull-right">
                    <?php echo $this->Html->link('<i class="icon-remove icon"></i> ' . __('Clear Cart'), array('controller' => 'shop', 'action' => 'clear'), array('icon' => 'fa fa-trash-o', 'class' => 'btn btn-danger', 'escape' => false)); ?>
                    <?php echo $this->Form->button('<i class="icon-refresh icon"></i> ' . __('Recalculate'), array('icon' => 'fa fa-calculator', 'class' => 'btn btn-default', 'escape' => false)); ?>
                    <?php echo $this->Form->end(); ?>
                </div>
            </div>
        </div>

        <hr>

        <div class="row">
            <div class="col-sm-12 pull-right tr">
                <div><?php echo __('Subtotal'); ?>: <span class="normal" id="subtotal"><?php echo $this->Formatacao->moeda($shop['Order']['subtotal']); ?></span></div>
                <!-- div><?php echo __('Sales Tax'); ?>: <span class="normal">N/A</span></div>
                <div><?php echo __('Shipping'); ?>: <span class="normal">N/A</span></div !-->
                <div><?php echo __('Order Total'); ?>: <span class="red" id="total"><?php echo $this->Formatacao->moeda($shop['Order']['total']); ?></span></div>
                    <?php echo $this->Html->link('<i class="fa fa-shopping-cart"></i> ' . __('Checkout'), array('controller' => 'shop', 'action' => 'login'), array('class' => 'btn btn-primary', 'escape' => false)); ?>
            </div>
        </div>

        <br />
        <br />
    <?php }
    ?>
</div>



